Optimal. Leaf size=198 \[ \frac {\left (4 a^2 A+3 A b^2+6 a b B\right ) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {\left (4 b^2 B+5 a (2 A b+a B)\right ) \tan (c+d x)}{5 d}+\frac {\left (4 a^2 A+3 A b^2+6 a b B\right ) \sec (c+d x) \tan (c+d x)}{8 d}+\frac {b (5 A b+6 a B) \sec ^3(c+d x) \tan (c+d x)}{20 d}+\frac {b B \sec ^3(c+d x) (a+b \sec (c+d x)) \tan (c+d x)}{5 d}+\frac {\left (4 b^2 B+5 a (2 A b+a B)\right ) \tan ^3(c+d x)}{15 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.20, antiderivative size = 198, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {4111, 4132,
3852, 4131, 3853, 3855} \begin {gather*} \frac {\left (4 a^2 A+6 a b B+3 A b^2\right ) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {\left (4 a^2 A+6 a b B+3 A b^2\right ) \tan (c+d x) \sec (c+d x)}{8 d}+\frac {\left (5 a (a B+2 A b)+4 b^2 B\right ) \tan ^3(c+d x)}{15 d}+\frac {\left (5 a (a B+2 A b)+4 b^2 B\right ) \tan (c+d x)}{5 d}+\frac {b (6 a B+5 A b) \tan (c+d x) \sec ^3(c+d x)}{20 d}+\frac {b B \tan (c+d x) \sec ^3(c+d x) (a+b \sec (c+d x))}{5 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3852
Rule 3853
Rule 3855
Rule 4111
Rule 4131
Rule 4132
Rubi steps
\begin {align*} \int \sec ^3(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx &=\frac {b B \sec ^3(c+d x) (a+b \sec (c+d x)) \tan (c+d x)}{5 d}+\frac {1}{5} \int \sec ^3(c+d x) \left (a (5 a A+3 b B)+\left (4 b^2 B+5 a (2 A b+a B)\right ) \sec (c+d x)+b (5 A b+6 a B) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {b B \sec ^3(c+d x) (a+b \sec (c+d x)) \tan (c+d x)}{5 d}+\frac {1}{5} \int \sec ^3(c+d x) \left (a (5 a A+3 b B)+b (5 A b+6 a B) \sec ^2(c+d x)\right ) \, dx+\frac {1}{5} \left (4 b^2 B+5 a (2 A b+a B)\right ) \int \sec ^4(c+d x) \, dx\\ &=\frac {b (5 A b+6 a B) \sec ^3(c+d x) \tan (c+d x)}{20 d}+\frac {b B \sec ^3(c+d x) (a+b \sec (c+d x)) \tan (c+d x)}{5 d}+\frac {1}{4} \left (4 a^2 A+3 A b^2+6 a b B\right ) \int \sec ^3(c+d x) \, dx-\frac {\left (4 b^2 B+5 a (2 A b+a B)\right ) \text {Subst}\left (\int \left (1+x^2\right ) \, dx,x,-\tan (c+d x)\right )}{5 d}\\ &=\frac {\left (4 b^2 B+5 a (2 A b+a B)\right ) \tan (c+d x)}{5 d}+\frac {\left (4 a^2 A+3 A b^2+6 a b B\right ) \sec (c+d x) \tan (c+d x)}{8 d}+\frac {b (5 A b+6 a B) \sec ^3(c+d x) \tan (c+d x)}{20 d}+\frac {b B \sec ^3(c+d x) (a+b \sec (c+d x)) \tan (c+d x)}{5 d}+\frac {\left (4 b^2 B+5 a (2 A b+a B)\right ) \tan ^3(c+d x)}{15 d}+\frac {1}{8} \left (4 a^2 A+3 A b^2+6 a b B\right ) \int \sec (c+d x) \, dx\\ &=\frac {\left (4 a^2 A+3 A b^2+6 a b B\right ) \tanh ^{-1}(\sin (c+d x))}{8 d}+\frac {\left (4 b^2 B+5 a (2 A b+a B)\right ) \tan (c+d x)}{5 d}+\frac {\left (4 a^2 A+3 A b^2+6 a b B\right ) \sec (c+d x) \tan (c+d x)}{8 d}+\frac {b (5 A b+6 a B) \sec ^3(c+d x) \tan (c+d x)}{20 d}+\frac {b B \sec ^3(c+d x) (a+b \sec (c+d x)) \tan (c+d x)}{5 d}+\frac {\left (4 b^2 B+5 a (2 A b+a B)\right ) \tan ^3(c+d x)}{15 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.60, size = 150, normalized size = 0.76 \begin {gather*} \frac {15 \left (4 a^2 A+3 A b^2+6 a b B\right ) \tanh ^{-1}(\sin (c+d x))+\tan (c+d x) \left (15 \left (4 a^2 A+3 A b^2+6 a b B\right ) \sec (c+d x)+30 b (A b+2 a B) \sec ^3(c+d x)+8 \left (15 \left (2 a A b+a^2 B+b^2 B\right )+5 \left (2 a A b+a^2 B+2 b^2 B\right ) \tan ^2(c+d x)+3 b^2 B \tan ^4(c+d x)\right )\right )}{120 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.44, size = 221, normalized size = 1.12
method | result | size |
derivativedivides | \(\frac {a^{2} A \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-a^{2} B \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )-2 A b a \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+2 B a b \left (-\left (-\frac {\left (\sec ^{3}\left (d x +c \right )\right )}{4}-\frac {3 \sec \left (d x +c \right )}{8}\right ) \tan \left (d x +c \right )+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )+A \,b^{2} \left (-\left (-\frac {\left (\sec ^{3}\left (d x +c \right )\right )}{4}-\frac {3 \sec \left (d x +c \right )}{8}\right ) \tan \left (d x +c \right )+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )-b^{2} B \left (-\frac {8}{15}-\frac {\left (\sec ^{4}\left (d x +c \right )\right )}{5}-\frac {4 \left (\sec ^{2}\left (d x +c \right )\right )}{15}\right ) \tan \left (d x +c \right )}{d}\) | \(221\) |
default | \(\frac {a^{2} A \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-a^{2} B \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )-2 A b a \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+2 B a b \left (-\left (-\frac {\left (\sec ^{3}\left (d x +c \right )\right )}{4}-\frac {3 \sec \left (d x +c \right )}{8}\right ) \tan \left (d x +c \right )+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )+A \,b^{2} \left (-\left (-\frac {\left (\sec ^{3}\left (d x +c \right )\right )}{4}-\frac {3 \sec \left (d x +c \right )}{8}\right ) \tan \left (d x +c \right )+\frac {3 \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{8}\right )-b^{2} B \left (-\frac {8}{15}-\frac {\left (\sec ^{4}\left (d x +c \right )\right )}{5}-\frac {4 \left (\sec ^{2}\left (d x +c \right )\right )}{15}\right ) \tan \left (d x +c \right )}{d}\) | \(221\) |
norman | \(\frac {-\frac {4 \left (50 A b a +25 a^{2} B +29 b^{2} B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{15 d}+\frac {\left (4 a^{2} A -16 A b a +5 A \,b^{2}-8 a^{2} B +10 B a b -8 b^{2} B \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}-\frac {\left (4 a^{2} A +16 A b a +5 A \,b^{2}+8 a^{2} B +10 B a b +8 b^{2} B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}-\frac {\left (12 a^{2} A -64 A b a +3 A \,b^{2}-32 a^{2} B +6 B a b -16 b^{2} B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}+\frac {\left (12 a^{2} A +64 A b a +3 A \,b^{2}+32 a^{2} B +6 B a b +16 b^{2} B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{5}}-\frac {\left (4 a^{2} A +3 A \,b^{2}+6 B a b \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{8 d}+\frac {\left (4 a^{2} A +3 A \,b^{2}+6 B a b \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{8 d}\) | \(325\) |
risch | \(-\frac {i \left (60 a^{2} A \,{\mathrm e}^{9 i \left (d x +c \right )}+45 A \,b^{2} {\mathrm e}^{9 i \left (d x +c \right )}+90 B a b \,{\mathrm e}^{9 i \left (d x +c \right )}+120 A \,a^{2} {\mathrm e}^{7 i \left (d x +c \right )}+210 A \,b^{2} {\mathrm e}^{7 i \left (d x +c \right )}+420 B a b \,{\mathrm e}^{7 i \left (d x +c \right )}-480 A a b \,{\mathrm e}^{6 i \left (d x +c \right )}-240 B \,a^{2} {\mathrm e}^{6 i \left (d x +c \right )}-1120 A a b \,{\mathrm e}^{4 i \left (d x +c \right )}-560 B \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-640 B \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-120 a^{2} A \,{\mathrm e}^{3 i \left (d x +c \right )}-210 A \,b^{2} {\mathrm e}^{3 i \left (d x +c \right )}-420 B a b \,{\mathrm e}^{3 i \left (d x +c \right )}-800 A a b \,{\mathrm e}^{2 i \left (d x +c \right )}-400 B \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-320 B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-60 a^{2} A \,{\mathrm e}^{i \left (d x +c \right )}-45 A \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-90 B a b \,{\mathrm e}^{i \left (d x +c \right )}-160 A b a -80 a^{2} B -64 b^{2} B \right )}{60 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{5}}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2} A}{2 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,b^{2}}{8 d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B a b}{4 d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2} A}{2 d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,b^{2}}{8 d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B a b}{4 d}\) | \(462\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 276, normalized size = 1.39 \begin {gather*} \frac {80 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} B a^{2} + 160 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} A a b + 16 \, {\left (3 \, \tan \left (d x + c\right )^{5} + 10 \, \tan \left (d x + c\right )^{3} + 15 \, \tan \left (d x + c\right )\right )} B b^{2} - 30 \, B a b {\left (\frac {2 \, {\left (3 \, \sin \left (d x + c\right )^{3} - 5 \, \sin \left (d x + c\right )\right )}}{\sin \left (d x + c\right )^{4} - 2 \, \sin \left (d x + c\right )^{2} + 1} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 15 \, A b^{2} {\left (\frac {2 \, {\left (3 \, \sin \left (d x + c\right )^{3} - 5 \, \sin \left (d x + c\right )\right )}}{\sin \left (d x + c\right )^{4} - 2 \, \sin \left (d x + c\right )^{2} + 1} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 60 \, A a^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )}}{240 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.61, size = 208, normalized size = 1.05 \begin {gather*} \frac {15 \, {\left (4 \, A a^{2} + 6 \, B a b + 3 \, A b^{2}\right )} \cos \left (d x + c\right )^{5} \log \left (\sin \left (d x + c\right ) + 1\right ) - 15 \, {\left (4 \, A a^{2} + 6 \, B a b + 3 \, A b^{2}\right )} \cos \left (d x + c\right )^{5} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (16 \, {\left (5 \, B a^{2} + 10 \, A a b + 4 \, B b^{2}\right )} \cos \left (d x + c\right )^{4} + 15 \, {\left (4 \, A a^{2} + 6 \, B a b + 3 \, A b^{2}\right )} \cos \left (d x + c\right )^{3} + 24 \, B b^{2} + 8 \, {\left (5 \, B a^{2} + 10 \, A a b + 4 \, B b^{2}\right )} \cos \left (d x + c\right )^{2} + 30 \, {\left (2 \, B a b + A b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{240 \, d \cos \left (d x + c\right )^{5}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2} \sec ^{3}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 528 vs.
\(2 (186) = 372\).
time = 0.54, size = 528, normalized size = 2.67 \begin {gather*} \frac {15 \, {\left (4 \, A a^{2} + 6 \, B a b + 3 \, A b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 15 \, {\left (4 \, A a^{2} + 6 \, B a b + 3 \, A b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (60 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} - 120 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} - 240 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} + 150 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} + 75 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} - 120 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{9} - 120 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 320 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 640 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 60 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 30 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 160 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 400 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 800 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 464 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 120 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 320 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 640 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 60 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 30 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 160 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 60 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 120 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 240 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 150 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 75 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 120 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{5}}}{120 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.71, size = 359, normalized size = 1.81 \begin {gather*} \frac {\mathrm {atanh}\left (\frac {4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {A\,a^2}{2}+\frac {3\,B\,a\,b}{4}+\frac {3\,A\,b^2}{8}\right )}{2\,A\,a^2+3\,B\,a\,b+\frac {3\,A\,b^2}{2}}\right )\,\left (A\,a^2+\frac {3\,B\,a\,b}{2}+\frac {3\,A\,b^2}{4}\right )}{d}-\frac {\left (2\,B\,a^2-\frac {5\,A\,b^2}{4}-A\,a^2+2\,B\,b^2+4\,A\,a\,b-\frac {5\,B\,a\,b}{2}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^9+\left (2\,A\,a^2+\frac {A\,b^2}{2}-\frac {16\,B\,a^2}{3}-\frac {8\,B\,b^2}{3}-\frac {32\,A\,a\,b}{3}+B\,a\,b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\left (\frac {20\,B\,a^2}{3}+\frac {40\,A\,a\,b}{3}+\frac {116\,B\,b^2}{15}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (-2\,A\,a^2-\frac {A\,b^2}{2}-\frac {16\,B\,a^2}{3}-\frac {8\,B\,b^2}{3}-\frac {32\,A\,a\,b}{3}-B\,a\,b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (A\,a^2+\frac {5\,A\,b^2}{4}+2\,B\,a^2+2\,B\,b^2+4\,A\,a\,b+\frac {5\,B\,a\,b}{2}\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{10}-5\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8+10\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-10\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+5\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________